# coding=utf-8

from fastapi import APIRouter, Depends

from routers.task import task_api
from utils.dependencies import check_access_token, check_user_defined_article_rewrite_permissions

router = APIRouter(
    dependencies=[Depends(check_access_token)]
)


router.add_api_route(
    '/list/',
    task_api.get_tasks,
    methods=['get'],
    summary='获取任务列表',
    description="通过用户访问令牌，获取任务列表"
)


router.add_api_route(
    '/',
    task_api.create_task,
    methods=['post'],
    summary='创建任务',
    description="提交任务"
)


router.add_api_route(
    '/',
    task_api.get_task_base_info,
    methods=['get'],
    summary='获取任务基础信息',
    description="通过任务id，获取任务基础信息"
)


router.add_api_route(
    '/',
    task_api.update_task,
    methods=['put'],
    summary='更新任务状态',
    description="通过任务id，更新任务状态"
)


router.add_api_route(
    '/user_defined_article/',
    task_api.create_user_defined_article_rewrite_task,
    dependencies=[Depends(check_user_defined_article_rewrite_permissions)],
    methods=['post'],
    summary='创建用户自定义文章改写任务',
    description="提交用户自定义文章改写任务"
)
